# video兼容处理

# 层级过高

通过定位一个封面图,在需要处理别的事件时将video

display: 'none'

同时将封面图显示出来

处理完再恢复原样

# 同时只播放一个视频

watchVideo () {
  this.$nextTick(() => {
    let au = document.getElementsByTagName('video')
    for (let i = 0; i < au.length; i++) {
      au[i].addEventListener('playing', function () {
        let this1 = this
        this.play()
        for (let b = 0; b < au.length; b++) {
          let this2 = au[b]
          if (this1 !== this2) {
            this2.pause()
          }
        }
      })
    }
  })
},

即监听所有video播放事件

播放时将别的给暂停了